/*
 * Created on 15.10.2006 by leck
 *
 */
package de.devisnik.eidle.util;


public class Parameters {

    private final String[] itsStrings;

    public Parameters(String[] strings) {
        itsStrings = strings;
    }

    /**
     * set preferences?
     * @return
     */
    public boolean isConfigurationMode() {
        if (itsStrings.length == 0) {
            return false;
        }
        return itsStrings[0].startsWith("/c");
    }

    /**
     * is previewing in given windows handle
     * @return
     */
    public boolean isPreviewMode() {
        return itsStrings.length == 2 && itsStrings[0].equals("/p") ;
    }

    /**
     * the windows handle in previewing mode
     * @return
     */
    public Integer getScreenHandle() {
        return Integer.valueOf(itsStrings[1]);
    }

    
    /**
     * runs as screen saver?
     * @return
     */
    public boolean isSaverMode() {
        if (itsStrings.length == 0) {
            return false;
        }
        return itsStrings[0].equals("/s");
    }

    public String toString() {
        StringBuffer paramBuffer = new StringBuffer();
        String sep = "";
        for (int i = 0; i < itsStrings.length; i++) {
            paramBuffer.append(sep);
            paramBuffer.append(itsStrings[i]);
            sep = " ";
        }
        return paramBuffer.toString();
    }
}
